package com.en.sharing.serviceprovider;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 服务提供者框架：JDBC 实现
 *      DriverManager.registerDriver()：服务注册接口
 *      com.mysql.jdbc.Driver()：服务提供者
 *      DriverManager.getConnection()：服务访问接口
 *      Driver.connect()：服务接口
 *
 * @author 付晓飞
 * @date 2024/3/11 7:38 下午
 */
public class JDBCConnection {

    static {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public Connection connect() throws SQLException {
        final Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test", "root", "123456");
        return connection;
    }

}
